home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / PASSDK30.ZIP;1 / DISK1.ZIP / PAS / CDROMAPP / CDSTATUS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  2.0 KB  |  117 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos.h>
  4.  
  5. #define OKAY 0
  6.  
  7. #include "cdmaster.h"
  8.  
  9. char *syntax= "Syntax: cdstatus [drive #].\n";
  10. char *nodrives= "No CDROM drives attached.\n";
  11. char *nomscdex= "MSCDEX is not installed.\n";
  12.  
  13. int SPECIFIEDIT;
  14. char cdu[26];
  15.  
  16. char *copyright= "cdstatus.exe - Copyright Media Vision, 1992\n";
  17. char *programmer= "Bart Crane";
  18.  
  19. main(int argc, char **argv)
  20. {
  21.     int numcdroms= 0;
  22.     int ourdrive= 0;
  23.     struct cdtable *cdt;
  24.  
  25.     if (!ismscdex())
  26.         {
  27.         fprintf(stderr, nomscdex);
  28.         return(1);
  29.         }
  30.  
  31.     if (!(numcdroms= getnumcdroms()))
  32.         {
  33.         fprintf(stderr, nodrives);
  34.         return(2);
  35.         }
  36.  
  37.     getcdromunits(cdu);
  38.  
  39.     switch (argc)
  40.         {
  41.         case 2:
  42.             SPECIFIEDIT= 1;
  43.             if (!(ourdrive= atoi(argv[1])))
  44.                 {
  45.                 fprintf(stderr, syntax);
  46.                 return(3);
  47.                 }
  48.             break;
  49.  
  50.         case 1:
  51.             if (!(ourdrive= getfirstcdrom()))
  52.                 {
  53.                 fprintf(stderr, nodrives);
  54.                 return(4);
  55.                 }
  56.             break;
  57.  
  58.         default:
  59.             fprintf(stderr, syntax);
  60.             return(5);
  61.         }
  62.  
  63.     if (SPECIFIEDIT)
  64.         {
  65.         printf("status drive: %2d ", ourdrive);
  66.  
  67.         if (cdt= createaudiotoc(ourdrive))
  68.             {
  69.             int status= cdstatus(ourdrive);
  70.             if (!status)
  71.                 printf("nonexistent.\n");
  72.             else
  73.                 printf("= %X: Playing: %s, Paused: %s.\n",
  74.                     status,
  75.                     status& CDISPLAYING ? "yes" : "no",
  76.                     status& CDISPAUSED ? "yes" : "no");
  77.             destroyaudiotoc(ourdrive);
  78.             }
  79.         else
  80.             printf("failed, no initialization.\n");
  81.         return(OKAY);
  82.         }
  83.  
  84.         {
  85.         int i;
  86.  
  87.         for (i= 0; i < 26; i++)
  88.             {
  89.             if (cdu[i])
  90.                 {
  91.                 ourdrive= (int) cdu[i];
  92.                 printf("status drive: %2d ", ourdrive);
  93.  
  94.                 if (cdt= createaudiotoc(ourdrive))
  95.                     {
  96.                     int status= cdstatus(ourdrive);
  97.                     if (!status)
  98.                         printf("nonexistent.\n");
  99.                     else
  100.                         printf("= %X: Playing: %s, Paused: %s.\n",
  101.                             status,
  102.                             status& CDISPLAYING ? "yes" : "no",
  103.                             status& CDISPAUSED ? "yes" : "no");
  104.                     destroyaudiotoc(ourdrive);
  105.                     }
  106.                 else
  107.                     printf("failed, no initialization.\n");
  108.                 }
  109.             }
  110.         }
  111.  
  112.     
  113.  
  114.     return(OKAY);
  115. }
  116.  
  117.